package com.yuanfeng.userms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.commoms.vo.user.UserInfoVO;
import com.yuanfeng.userms.entity.UserBindConnectEntity;
import com.yuanfeng.userms.mapper.UserBindConnectMapper;
import com.yuanfeng.userms.service.UserBindConnectService;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 *
 */
@Service
public class UserBindConnectServiceImpl extends ServiceImpl<UserBindConnectMapper, UserBindConnectEntity>
    implements UserBindConnectService{

    @Override
    public String selectUserIdByOpenid(String bindOpenid) {
        return this.baseMapper.selectUserIdByOpenid(bindOpenid);
    }

    @Override
    public UserInfoVO getUserInfoByUserId(String bindId) {
        return this.baseMapper.getUserInfoByUserId(bindId);
    }

    @Override
    public ResponseResult updateAotuLogin(Map<String, Object> paramMap) {
        this.baseMapper.updateAotuLogin(paramMap);
        return ResponseResult.success();
    }

    @Override
    public ResponseResult insertUserThreeBindMap(Map<String, Object> userThreeBindMap) {
        String threebindId = this.baseMapper.selectUserIdByBindId(userThreeBindMap.get("bindId").toString());

        if (null == threebindId) {
            this.baseMapper.insertUserThreeBindMap(userThreeBindMap);
        }
        return ResponseResult.success();
    }

    @Override
    public void updateUserNickNameavAtarUrl(Map<String, Object> updateUserParam) {
        this.baseMapper.updateUserNickNameavAtarUrl(updateUserParam);
    }

    @Override
    public Integer queryAutoLogin(String openId) {
        return this.baseMapper.queryAutoLogin(openId);
    }
}




